package com.hy.aicodegeneration.controller;

import com.hy.aicodegeneration.core.pool.WebDriverPool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/screenshot")
@Slf4j
public class ScreenshotMonitorController {

    @Autowired
    private WebDriverPool webDriverPool;

    @GetMapping("/pool/status")
    public Map<String, Object> getPoolStatus() {
        Map<String, Object> status = new HashMap<>();
        status.put("activeCount", webDriverPool.getActiveCount());
        status.put("availableCount", webDriverPool.getAvailableCount());
        status.put("maxPoolSize", webDriverPool.getMaxPoolSize());
        return status;
    }
}
